package cn.ytian.scashier;

import java.util.List;

import static cn.ytian.scashier.YLib.inFileB;

public class Language {
    public static String LoginNot = "登陆失败";
    public static String InName = "请输入账号：";
    public static String InPassword = "请输入密码：";
    public static String ErrNot = "!错误！登陆失败，请检查账号与密码，您还有%d次登陆机会。";
    public static String RunNbr = "请输入功能项[0-%d]:";

    public static String LH_serial = "序号";
    public static String LH_Id = "编号";
    public static String LH_Name = "名称";
    public static String LH_Price = "单价";
    public static String LH_Quantity = "数量";
    public static String LH_Subtotal = "小计";
    public static String Grand_Total = "全部商品的总价是 %.2f (输入Y确定购买):";
    public static String Grand_Not_Total = "没有购买任何商品(输入任意继续):";
    public static String Menu_Title = "菜单";
    public static List<String> Menu_List = List.of("收银系统", "录入商品", "查询商品", "全部商品", "系统设置");
    public static String Menu_Exit = "退出系统";
    public static String Menu_Exit_ = "退出成功";
    public static String Menu_Not_Func = "该功能还在制作中(输入任意继续).....";

    public static String Info_addProduct = "自动判断(Txt,Csv文件类型)请输入文件路径(N退出)：";
    public static String Info_addProduct_Determine = "是否录入(Y*/N):";
    public static String Info_addProduct_NotType = "目前暂时只支持Txt,Csv文件(输入N返回菜单,输入其他重新开始):";
    public static String Info_addProduct_NotFile = "该文件不存在(输入N返回菜单,输入其他重新开始):";

    public static String Sales_info = " 销售明细 ";
    public static String productMap_info = " 商品列表 ";
    public static String Load_yyds = "加载%s成功";

    public static String Sales_Info = "输入商品编号(S:打印单价,E:退出):";
    public static String Sales_Not_Product = "无此商品,";
    public static String Sales_POrderQty = "请输入购买(%s)的数量:";
    static String Ste_System;
    static String MSte_System_Exit;
    static List<String> Ste_System_List;
    static String Ste_Lang_ln;
    static String Ste_Lang_NotLang;
    static String Sales_PLH;
    static String Sales_Record;
    static String Sales_Edit;
    static String Any;


    public static void load(Config conf) {
        load(conf.getLanguage());
    }

    public static boolean load(String type) {
        String path = "src/lang/" + type + ".properties";
        if (!inFileB(path)){
            return false;
        }
        YConfig Yc = new YConfig(path);
        //GetAllProperties();
        LoginNot = Yc.GetValue("LoginNot");
        InName = Yc.GetValue("InName");
        InPassword = Yc.GetValue("InPassword");
        ErrNot = Yc.GetValue("ErrNot");
        RunNbr = Yc.GetValue("RunNbr");
        LH_serial = Yc.GetValue("LH_serial");
        LH_Id = Yc.GetValue("LH_Id");
        LH_Name = Yc.GetValue("LH_Name");
        LH_Price = Yc.GetValue("LH_Price");
        LH_Quantity = Yc.GetValue("LH_Quantity");
        LH_Subtotal = Yc.GetValue("LH_Subtotal");
        Grand_Total = Yc.GetValue("Grand_Total");
        Grand_Not_Total = Yc.GetValue("Grand_Not_Total");
        Menu_Title = Yc.GetValue("Menu_Title");
        Menu_List = Yc.GetList("Menu_List");
        Menu_Exit = Yc.GetValue("Menu_Exit");
        Menu_Exit_ = Yc.GetValue("Menu_Exit_");
        Menu_Not_Func = Yc.GetValue("Menu_Not_Func");
        Info_addProduct = Yc.GetValue("Info_addProduct");
        Info_addProduct_Determine = Yc.GetValue("Info_addProduct_Determine");
        Info_addProduct_NotType = Yc.GetValue("Info_addProduct_NotType");
        Info_addProduct_NotFile = Yc.GetValue("Info_addProduct_NotFile");
        Sales_info = Yc.GetValue("Sales_info");
        productMap_info = Yc.GetValue("productMap_info");
        Load_yyds = Yc.GetValue("Load_yyds");
        Sales_Info = Yc.GetValue("Sales_Info");
        Sales_Not_Product = Yc.GetValue("Sales_Not_Product");
        Sales_POrderQty = Yc.GetValue("Sales_POrderQty");
        Ste_System = Yc.GetValue("Ste_System");
        Ste_System_List = Yc.GetList("Ste_System_List");
        MSte_System_Exit = Yc.GetValue("Ste_System_Exit");
        Ste_Lang_ln = Yc.GetValue("Ste_Lang_ln");
        Ste_Lang_NotLang = Yc.GetValue("Ste_Lang_NotLang");
        Sales_Record = Yc.GetValue("Sales_Record");
        Sales_PLH = Yc.GetValue("Sales_PLH");
        Sales_Edit = Yc.GetValue("Sales_Edit");
        Any = Yc.GetValue("Any");
        return true;
    }
}
